define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.user/index',
        add_url: 'user.user/add',
        edit_url: 'user.user/edit',
        delete_url: 'user.user/delete',
        export_url: 'user.user/export',
        modify_url: 'user.user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'username', title: '账号'},
                    {field: 'nickname', title: '昵称'},
                    {field: 'full_name', title: '真实姓名'},
                    {field: 'money', title: '余额'},
                    {field: 'fake_money', title: '预扣余额'},
                    {field: 'integral', title: '积分'},
                    {
                        field: 'status', title: '用户状态', templet: function (d) {
                            return ea.table.switch({id: d.status, status: d.status}, {
                                tips: '正常|禁用',
                                checked: d.status,
                                field: 'status'
                            })
                        }
                    },
                    {field: 'level', title: '等级'},
                    {field: 'sign_sum', title: '连续签到天数'},
                    {field: 'create_time', title: '用户创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});